package WaiBao;

import java.util.Arrays;

public class WangFeiFei {
    public static void main(String[] args) {
        String[] name = {"周依一(班长)", "陶程璐(副班长)", "小李(学习委员)", "量程金(纪律委员)", "卢赵兴(体育委员)", "理财早", "合一", "莫玉玺", "李大虎", "祝福留", "唐县", "月返利",
                "张浩宇", "杜玉米", "李大宝", "范根线", "方文山", "李紫陌", "唐嫣", "小龙女", "龙葵", "白豆腐", "茂茂", "车之重", "王伟强", "认为光", "何刚明", "邱正书",
                "杨紫", "王菲菲(学生)"};//最后一位考生本人: 王菲菲(学生)
        int[] Age = {18, 19, 21, 21, 22, 22, 21, 22, 19, 20, 18, 20, 18, 20, 20, 19, 18, 18, 18, 18, 19, 19, 20, 20, 20, 18, 19, 19, 18, 19};//考生年龄：19岁

        double[]  group1 = {94, 84, 93, 80, 71, 87, 76, 49, 89, 90, 90, 87, 85, 79, 65, 68, 69, 99, 96, 88, 92, 91, 95, 88, 65, 74, 77, 74, 84, 96};
        double[]  group2 = {78, 87, 75, 70, 86, 91, 71, 74, 91, 75, 90, 77, 86, 75, 65, 65, 86, 79, 66, 68, 92, 71, 95, 85, 79, 84, 79, 66, 91, 96};
        double[]  group3 = {76, 98, 90, 81, 71, 64, 76, 79, 85, 60, 94, 87, 85, 75, 65, 68, 69, 69, 96, 93, 92, 81, 95, 95, 79, 84, 72, 71, 85, 97};



        double top1;//代表每个学生的总分
        double top2;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            top1 = (group1)[i] + group2[i] +group3[i];
//            top2 = ( top1 * 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" + top1);
//            System.out.println(name[i] + "的平均分为:" + top2);
//        }

        double jiaban1 = 0, jiaban2 = 0;
        double[] chong = new double[30];
//        for (int i = 0; i < 30; i++) {
//            jiaban1  = group1[i] + group2[i] + group3[i];
//            jiaban2 = (jiaban1 * 1.0) / 3;
//            chong[i] = jiaban2;
//        }
//
//        for (int i = 0; i < chong.length - 1; i++) {
//            for (int j = 0; j < chong.length - i - 1; j++) {
//                if (chong[j] < chong[j + 1]) {
//                    double tep = chong[j];
//                    chong[j] =chong[j + 1];
//                    chong[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(chong[i]);
//        }


        double yungang1 = 0, yungang2 = 0,yungang3 = 0;//计算每门课的平均分
        double henshan1 = 0,henshan2 = 0,henshan3 = 0;//计算每门课标准差
        double taisan1 = 0,taisan2 = 0, taisan3 = 0;//计算每门课中位数
        double sum2 = 0;
        for (int i = 0; i < group1.length; i++) {
            sum2+=group1[i];
        }
        yungang1 = (sum2*1.0)/30;
        System.out.println("生物化学的班级平均分为:"+ yungang1);
        double Sum = 0;
        for (int i = 0; i < group2.length; i++) {
            Sum+=group2[i];
        }
        yungang2 = (Sum*1.0)/30;
        System.out.println("微生物学的班级平均分为:"+yungang2);
        double sum = 0;
        for (int i = 0; i <group3.length; i++) {
            sum+=group3[i];
        }
        yungang3 = (sum*1.0)/30;
        System.out.println("人体组织解剖学的班级平均分为:"+ yungang3);


//////
        double c1 = 0,c2 = 0,c3 = 0;
        for (int i = 0; i <group1.length; i++) {
            c1+= (group1[i] -yungang1)*(group1[i] - yungang1);
        }
        henshan1 = Math.sqrt(c1*1.0/30);
        System.out.println("生物化学的班级标准差为:"+henshan1);

        for (int i = 0; i < group2.length; i++) {
            c2+= (group2[i] -  yungang2)*(group2[i] -yungang2);
        }
        henshan2 = Math.sqrt(c2*1.0/30);
        System.out.println("微生物学的班级标准差为:"+henshan2);

        for (int i = 0; i < group3.length; i++) {
            c3+= (group3[i] - yungang3)*(group3[i] - yungang3);
        }
        henshan3 = Math.sqrt(c3*1.0/30);
        System.out.println("人体组织解剖学的班级标准差为:"+henshan3);
////////////
//////////////
//        Arrays.sort(group1);
//        Arrays.sort(group2);
//        Arrays.sort(group3);
//        taisan1 =( group1[14]+group1[15])*1.0/2;
//        taisan2 =(group2[14]+group2[15])*1.0/2;
//        taisan3 =( group3[14]+group3[15])*1.0/2;
//        System.out.println("生物化学的中位数为:"+taisan1);
//        System.out.println("微生物学的中位数为:"+taisan2);
//        System.out.println("人体组织解剖学的中位数为:"+taisan3);








    }
}
